//
//  CCProgressHUD.m
//  
//
//  Created by its on 15/4/22.
//
//

#import "CCProgressHUD.h"

@implementation CCProgressHUD

+ (void) showHUBInView:(UIView *)view withTimeOut:(float)time str:(NSString *)str {
  [MBProgressHUD hideAllHUDsForView:view animated:NO];
  MBProgressHUD *HUD = [MBProgressHUD showHUDAddedTo:view animated:YES];
  if (time > 0) {
    [HUD hide:YES afterDelay:time];
  }
  HUD.labelText = str;
}

+ (void) hiddenHUBFromView:(UIView *)view {
  [MBProgressHUD hideAllHUDsForView:view animated:NO];
}

+ (void) showMessage:(UIView *) view withTimeOut:(float)time str:(NSString *) str {
  [MBProgressHUD hideAllHUDsForView:view animated:NO];
  MBProgressHUD *HUD = [MBProgressHUD showHUDAddedTo:view animated:YES];
  HUD.mode = MBProgressHUDModeText;
  if (time > 0) {
    [HUD hide:YES afterDelay:time];
  }
  HUD.labelText = str;
}

+ (void) showMessageinWindow:(float)time str:(NSString *)str {
  [CCProgressHUD showMessage:  [[UIApplication sharedApplication] windows][1] withTimeOut:time str:str];
}

@end
